package com.mabs.ground.client.common;

import com.google.gwt.activity.shared.Activity;
import com.google.gwt.activity.shared.ActivityMapper;
import com.google.gwt.place.shared.Place;
import com.mabs.ground.client.module.connexion.activity.ConnexionActivity;
import com.mabs.ground.client.module.connexion.place.ConnexionPlace;
import com.mabs.ground.client.module.mod1.activity.HelloActivity;
import com.mabs.ground.client.module.mod1.place.HelloPlace;
import com.mabs.ground.client.module.mod2.activity.GoodbyeActivity;
import com.mabs.ground.client.module.mod2.place.GoodbyePlace;

/**
 * @author <a href="Email: mohamedarbi.benslimane@allence-tunisie.com">Ben Slimane Arbi</a>
 * @version 1.0
 * @since 1.0 - 25 juil. 2014 - 19:12:37
 */
public class AppActivityMapper implements ActivityMapper {
private ClientFactory clientFactory ;

	    public AppActivityMapper(ClientFactory clientFactory) {
	        super();
	        this.clientFactory = clientFactory;
	    }

	    public Activity getActivity(Place place) {
	        if (place instanceof HelloPlace)
	            return new HelloActivity((HelloPlace) place,clientFactory);
	        else if (place instanceof GoodbyePlace)
	            return new GoodbyeActivity((GoodbyePlace) place,clientFactory);
	        else if(place instanceof ConnexionPlace)
	        	return new ConnexionActivity((ConnexionPlace)place, clientFactory);
	        return null;
	    }

}
